package com.sa.module.uif.pojo;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;

/**
 * 联系人
 * @author huangxin
 *
 */
@MappedSuperclass
public class AbstractContacts {

	private int id;
	private Users users;	//联系人所属的用户
	private String name;	//联系人姓名
	private String email;	//联系人邮箱
	
	public AbstractContacts(int id, Users users, String name, String email) {
		super();
		this.id = id;
		this.users = users;
		this.name = name;
		this.email = email;
	}
	
	public AbstractContacts() {
		super();
		// TODO Auto-generated constructor stub
	}
	
	@Id 
	@GeneratedValue(strategy=IDENTITY)	    
	@Column(name="ID", unique=true, nullable=false)
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "UID", nullable = true)
	public Users getUsers() {
		return users;
	}
	public void setUsers(Users users) {
		this.users = users;
	}
	
	@Column(name="name", nullable=true, length=30)
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	@Column(name="email", nullable=true, length=30)
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	@Override
	public String toString() {
		return "AbstractContacts [id=" + id + ", users=" + users + ", name="
				+ name + ", email=" + email + "]";
	}
	
	
}
